library(tidyverse)
library(data.table)
library(argparse)

list.files('~/snap-align/splited_sam/', full.names = TRUE) -> samlist
samlist[1]
fread('~/snap-align/rr.head.sam') -> sam1k
sam1k
sam1k |> filter(V6 != '363M')
fread('~/snap-align/rr.allmapped.sam') -> sam_allmap
sam_allmap |> filter(str_detect(V6, 'I|D')) -> rr_indel
sam1k |> mutate(V16 = str_replace(V16,'sm',as.character(1:1000)))
sam1k |> mutate(V16 = str_replace(V16,'sm',as.character(1:1000))) |> fwrite('~/snap-align/rr1k-per-sm.sam',col.names = FALSE, sep = '\t')

read_delim('~/snap-align/gg9909.vcf', comment = '##')
